﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Project.DTO;

namespace Project
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] != null)
            {
                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", "http://localhost:8788/upload.aspx");
            }
            else
            {
                
            }
            dlVideoList.DataSource = BUS.videoBUS.getAllVideo();
            dlVideoList.DataBind();
            int idVideo;
            if (Request.QueryString["idVideo"] != null)
            {
                idVideo = int.Parse(Request.QueryString["idVideo"]);
            }
            else {
                idVideo = 1;
            }
            videoDTO vdt = BUS.videoBUS.getAVideo(idVideo);
            lbTitleVideo.Text = vdt.titleVideo.ToString();
            
            userDTO ust = BUS.userBUS.getAUser(vdt.uploader);
            lbUploader.Text = ust.fullName.ToString();
        }

        protected void dlVideoList_SelectedIndexChanged(object sender, EventArgs e)
        {
           
        }
    }
}